/**
 * Project: happyouting-web-activity
 * 
 * File Created at 2009-11-12
 * $Id: SecurityScreen.java 102 2009-11-22 08:44:27Z worldmaomao $
 * 
 * Copyright 2008 Alibaba.com Croporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Alibaba Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Alibaba.com.
 */
package com.alibaba.happyouting.web.screen;

import com.alibaba.happyouting.web.common.security.DefaultSecurity;
import com.alibaba.happyouting.web.common.security.Security;
import com.alibaba.service.template.TemplateContext;
import com.alibaba.turbine.service.rundata.RunData;

/**
 * TODO Comment of SecurityScreen
 * @author xingyue.wangxy
 *
 */
public abstract class SecurityScreen extends NormalScreen{
    
    protected Security security = new DefaultSecurity();
    
    protected void execute(RunData rundata, TemplateContext context) {
        if(security != null && security.check(rundata, context)){
            doExecute(rundata, context);
        }
    }
    
    protected abstract void doExecute(RunData rundata, TemplateContext context);

    public Security getSecurity() {
        return security;
    }

    public void setSecurity(Security security) {
        this.security = security;
    }

}
